package leet.ku._206;

/**
 * Definition for singly-linked list. public class ListNode { int val; ListNode
 * next; ListNode(int x) { val = x; } }
 */
class ListNode {
	int val;
	ListNode next;

	ListNode(int x) {
		val = x;
	}
}

public class Solution {
	
	public ListNode reverseList(ListNode head) {
		ListNode now = null;
		while (head != null) {
			ListNode p = new ListNode(head.val);
			p.next = now;
			now = p;
			head = head.next;
		}
		return now;
	}
}